<html>
<head>

<title>
	mood analysis using Social networking sites
</title>
</head>

<body>


<center>

<p>Sample image
<!--
<p><img src="/images/google_logo.png"/>
<p>This image would be replaced by a proper logo later... used for sampling purposes
<hr>
-->
<p> Results page...
<p> text string passed on to me was - <%= params["message"] %>
</CENTER>
<% @sum_h = 0%>
<% @sum_s = 0%>

<p> got <%= @hash_for_view.length %> results from twitter search
<p> got <%= @hash_for_see.length %> results from  fb search
<%  @hash_for_view = @hash_for_view.merge!(@hash_for_see)%>
<p> got <%= @hash_for_view.length %> results from total search
<table border=1 >
<% @hsh_happy = @hash_for_view.select {|key,value| value > 0} %>
<p> got happy <%= @hsh_happy.length %> results from total search
<% @hsh_happy.each do |key, value| %>
        
						    <% @sum_h = @sum_h + value %>
							<% end %>
         
		 
		<tr>average happy score<td><% if @hsh_happy.length != 0   %>
                <%= @sum_h/@hsh_happy.length  %>
                <% end %></td> </tr> 
</table>

							<table border=1 >
							
<% @hsh_sad = @hash_for_view.select {|key,value| value < 0} %>
<p> got sad <%= @hsh_sad.length %> results from total search
<% @hsh_sad.each do |key, value| %>
 <% @sum_s = @sum_s + value %>
							<% end %>
         
		 
		<tr>Total Sad score<td><%= @sum_s %></td> </tr> 
</table>
Avg sad score <% if @hsh_sad.length != 0   %>
                <%= @sum_s/@hsh_sad.length  %>
                <% end %>
<table border=1 >
<% @hsh_sad.each do |key, value| %>
<tr> 

        <td><%= key %></td> 
        <td><%= value %></td>

<% end %>

</tr>
</table>
<table border=1 >
<% @hsh_neutral = @hash_for_view.length - (@hsh_happy.length + @hsh_sad.length)  %>
<p> got neutral<%= @hsh_neutral %> results from total search
<% @hsh_neutral = @hash_for_view.select {|key,value| value = 0} %>



<div id="cont1" style="width:660px; height:500px;"></div>
<script type="text/javascript" charset="utf-8">
  var chart;
$(document).ready(function() {
   chart = new Highcharts.Chart({
      chart: {
         renderTo: 'cont1',
         defaultSeriesType: 'column'
      },
      title: {
         text: 'Column chart with negative values'
      },
      xAxis: {
         categories: ['Happy', 'Neutral', 'Sad']
      },
      tooltip: {
         formatter: function() {
            return ''+
                this.series.name +': '+ this.y +'';
         }
      },
      credits: {
         enabled: false
      },
      series: [{
         name: 'Avg_Score',
         data: [ <%= @hsh_happy.length %> ,<%= @hsh_neutral %>,  <%= @hsh_sad.length %>]
      }]
   });
   
   
});
</script>

<!--
data: [{
	name: 'Point 1',
	color: '#00FF00',
	y: 0
}, {
	name: 'Point 2',
	color: '#FF00FF',
	y: 5
}]
-->

<%= @hash_for_view.inspect %>
<hr>
<%= @hash_for_see.inspect %>

</body>
</html>
